---
layout: "default"
title: "Bool"
description: "Swift documentation for 'Bool': A value type whose instances are either true or false."
keywords: "Bool,struct,swift,documentation,getMirror,boolValue,description,hashValue"
root: "/v1.2"
---

<div class="intro-declaration"><code class="language-swift">struct Bool</code></div>

<div class="discussion comment">
    <p>A value type whose instances are either <code>true</code> or <code>false</code>.</p>
</div>

<table class="standard">
<tr>
<th id="inheritance">Inheritance</th>
<td>
<code class="inherits">BooleanLiteralConvertible, BooleanType, Equatable, Hashable, Printable, Reflectable</code>
<span class="viz"><a href="hierarchy/">View Protocol Hierarchy &rarr;</a></span>
</td>
</tr>



<tr>
<th>Import</th>
<td><code class="language-swift">import Swift</code></td>
</tr>

</table>


<h3>Initializers</h3>
<div class="declaration" id="init">
<a class="toggle-link" data-toggle="collapse" href="#comment-init">init()</a><div class="comment collapse" id="comment-init"><div class="p">
    <p>Default-initialize Boolean value to <code>false</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">init()</code>

    </div></div>
</div>
<div class="declaration" id="init_">
<a class="toggle-link" data-toggle="collapse" href="#comment-init_">init(<wbr>_:)</a><div class="comment collapse" id="comment-init_"><div class="p">
    <p>Construct an instance representing the same logical value as
<code>value</code></p>

    <h4>Declaration</h4>    
    <code class="language-swift">init&lt;T : BooleanType&gt;(_ value: T)</code>

    </div></div>
</div>
<div class="declaration" id="init-builtinbooleanliteral_">
<a class="toggle-link" data-toggle="collapse" href="#comment-init-builtinbooleanliteral_">init(<wbr>_builtinBooleanLiteral:)</a><div class="comment collapse" id="comment-init-builtinbooleanliteral_"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">init(_builtinBooleanLiteral value: Builtin.Int1)</code>

    </div></div>
</div>
<div class="declaration" id="init-booleanliteral_">
<a class="toggle-link" data-toggle="collapse" href="#comment-init-booleanliteral_">init(<wbr>booleanLiteral:)</a><div class="comment collapse" id="comment-init-booleanliteral_"><div class="p">
    <p>Create an instance initialized to <code>value</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">init(booleanLiteral value: Bool)</code>

    </div></div>
</div>


<h3>Instance Variables</h3>
<div class="declaration" id="var-boolvalue_-bool">
<a class="toggle-link" data-toggle="collapse" href="#comment-var-boolvalue_-bool">var boolValue: Bool</a><div class="comment collapse" id="comment-var-boolvalue_-bool"><div class="p">
    <p>Identical to <code>self</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">var boolValue: Bool { get }</code>

    </div></div>
</div>
<div class="declaration" id="var-description_-string">
<a class="toggle-link" data-toggle="collapse" href="#comment-var-description_-string">var description: String</a><div class="comment collapse" id="comment-var-description_-string"><div class="p">
    <p>A textual representation of <code>self</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">var description: String { get }</code>

    </div></div>
</div>
<div class="declaration" id="var-hashvalue_-int">
<a class="toggle-link" data-toggle="collapse" href="#comment-var-hashvalue_-int">var hashValue: Int</a><div class="comment collapse" id="comment-var-hashvalue_-int"><div class="p">
    <p>The hash value.</p>

<p><strong>Axiom:</strong> <code>x == y</code> implies <code>x.hashValue == y.hashValue</code></p>

<p><strong>Note:</strong> the hash value is not guaranteed to be stable across
different invocations of the same program.  Do not persist the
hash value across program runs.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">var hashValue: Int { get }</code>

    </div></div>
</div>



<h3>Instance Methods</h3>
<div class="declaration" id="func-getmirror">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-getmirror">func getMirror()</a>
        
<div class="comment collapse" id="comment-func-getmirror"><div class="p">
    <p>Returns a mirror that reflects <code>self</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func getMirror() -&gt; MirrorType</code>
    
    
</div></div>
</div>


